import socket
import threading


def tcplink(sock, addr):
    while True:
        data = sock.recv(100)
        if data:
            sock.send(b'accept')
        else:
            continue
    sock.close()


if __name__ == '__main__':
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.bind(('127.0.0.1', 8080))
    s.listen(5)
    while True:
        print('wait...')
        sock, addr = s.accept()
        print('sock=', sock)
        print('addr=', addr)
        t = threading.Thread(target=tcplink, args=(sock, addr))
        t.start()
